package com.hunliji.monitor.share.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * File：ReceiveIdTypeEnum.java<br> Title: <br> Description: <br>
 *
 * @author lejin
 */
public enum ReceiveIdTypeEnum {
    OPEN_ID("open_id", "应用间隔离的唯一识别id"),
    USER_ID("user_id", "企业间隔离的唯一识别id"),
    UNION_ID("union_id", "飞书平台唯一识别id"),
    EMAIL("email", "邮件"),
    CHAT_ID("chat_id", "群里id"),
    ;

    private final String code;
    private final String msg;

    ReceiveIdTypeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static ReceiveIdTypeEnum getEnumByCode(String code) {
        return Stream.of(ReceiveIdTypeEnum.values()).filter(o -> Objects.equals(o.getCode(), code)).findAny().orElse(null);
    }
}
